import mcpi.minecraft as minecraft
import time
#56 11 -44
#56 11 -46
#53 11 -46
#53 11 -44
#大门52 11 -45
mc=minecraft.Minecraft.create()
# pos=mc.player.getTilePos()
# mc.postToChat("X=%d,y=%d,z=%d"%(pos.x,pos.y,pos.z))
rent = 0
while True:
    time.sleep(1)
    pos=mc.player.getTilePos()
    if pos.x==52 and pos.y==11 and pos.z==-45:
         mc.postToChat("Welcome Home")
    if pos.x >= 53 and pos.x <= 56 and pos.z >= -46 and pos.z <= -44:
        rent += 1
        mc.postToChat("you own me"+str(rent))
    if rent>20:
        mc.postToChat("go out!")
        mc.player.setPos(40, 11, -45)
        rent = 0